package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.dto.EmployeeLoginDTO;
import org.example.entity.Employee;

@Mapper
public interface Emplyeemapper {

    /**
     * 登录
     * @param employeeLoginDTO
     * @return
     */
    @Select("select * from employee where username=#{username} && password=#{password}")
    Employee delu(EmployeeLoginDTO employeeLoginDTO);

    /**
     * 注册
     * @param employee
     */
    @Insert("INSERT INTO employee (username, name, password,image,create_time,update_time,shouji)\n" +
            "VALUES\n" +
            "(#{username}, #{name}, #{password}, #{image},#{createTime},#{updateTime},#{shouji})")
    void zhuche(Employee employee);

    /**
     * 用户查询
     * @param employee
     * @return
     */
    @Select("select count(*) from employee where username=#{username}")
    Integer id(Employee employee);


    /**
     * 忘记密码
     * @param employee
     */
    @Update("UPDATE employee\n" +
            "SET password = #{password}\n" +
            "WHERE  username= #{username};")
    void wangji(Employee employee);

    /**
     * 查询
     * @param username
     * @return
     */
    @Select("select * from employee where username=#{username}")
    Employee chaxun(String username);

    /**
     * 账号修改
     *
     * @param ne
     * @param username
     * @param phone
     * @param newPassword
     * @param yonghuusername
     */
    void xg(String ne, String username, String phone, String newPassword, String yonghuusername);

    /**
     * 删除
     * @param username
     */
    @Delete("delete from employee where username=#{username}")
    void sc(String username);
}
